<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绘制矩形</title>
</head>
<body>
    <canvas id="canvas" width="600" height="600"></canvas>
    <script>
        const canvas = document.getElementById('canvas');
        const ctx = canvas.getContext('2d');

        // 绘制空心矩形
        ctx.strokeStyle = 'red';
        ctx.lineWidth = 50;
        ctx.strokeRect(100,100,400,400);

        // 绘制实心矩形
        ctx.fillStyle = 'orange';
        ctx.fillRect(100,100,400,400);
    </script>
</body> 
</html>